/**
 * Copyright (C) <2023> <Boundivore> <boundivore@foxmail.com>
 * <p>
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the Apache License, Version 2.0
 * as published by the Apache Software Foundation.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * Apache License, Version 2.0 for more details.
 * <p>
 * You should have received a copy of the Apache License, Version 2.0
 * along with this program; if not, you can obtain a copy at
 * http://www.apache.org/licenses/LICENSE-2.0.
 */
/**
 * 监控想配置文件
 * @author Tracy
 */

export const monitorItems = [
	{ ServiceName: 'DATALIGHT', ComponentName: '', Id: 'DATALIGHT' }
	// { ServiceName: 'DATALIGHT', ComponentName: 'Worker', Id: 'DATALIGHT-Worker' }
];
export const paramsConfig = {
	DATALIGHT: ['jobName', 'instance']
};
interface ConfigStyle {
	[key: string]: any[]; // 或者具体的值类型
}
export const config: ConfigStyle = {
	HOME: [
		{
			cols: [
				{ title: '服役节点数', key: '1-1', type: 'self', name: 'nodeCount', span: 3, unit: '' },
				{ title: '服务数量', key: '1-2', type: 'self', name: 'serviceCount', span: 3, unit: '' },
				{
					title: '部署组件数',
					key: '1-3',
					type: 'number',
					query: `count(up)`,
					span: 3,
					unit: ''
				},
				{
					title: 'CPU Cores',
					key: '1-4',
					type: 'number',
					query: `count(count by (instance, cpu) (node_cpu_seconds_total))`,
					span: 3,
					unit: ''
				},
				{
					title: 'RootFS Total',
					key: '1-5',
					type: 'byte',
					query: `sum(node_filesystem_size_bytes{job="MONITOR-NodeExporter", mountpoint="/", fstype!="rootfs"})`,
					span: 4
				},
				{
					title: 'RAM Total',
					key: '1-6',
					type: 'byte',
					query: `sum(node_memory_MemTotal_bytes{job="MONITOR-NodeExporter"})`,
					span: 4
				},
				{
					title: 'SWAP Total',
					key: '1-7',
					type: 'byte',
					query: `sum(node_memory_SwapTotal_bytes{job="MONITOR-NodeExporter"})`,
					span: 4
				}
			],
			height: '150px',
			key: '1'
		},
		{
			cols: [
				{
					title: 'CPU Busy',
					key: '2-1',
					type: 'gauge',
					span: 6,
					height: 250,
					query: `(
                        sum(
                          irate(node_cpu_seconds_total{job="MONITOR-NodeExporter", mode!="idle"}[1m])
                        ) 
                        / 
                        sum(
                          irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[1m])
                        )
                      ) * 100`
				},
				{
					title: 'Sys Load (5m avg)',
					key: '2-2',
					type: 'gauge',
					span: 6,
					height: 250,
					query: `(
                        avg(node_load5{job="MONITOR-NodeExporter"})
                      /
                        count(count by (cpu) (node_cpu_seconds_total{job="MONITOR-NodeExporter"}))
                    )
                  *
                    100`
				},
				{
					title: 'Sys Load (15m avg)',
					key: '2-3',
					type: 'gauge',
					span: 6,
					height: 250,
					query: `(
                        avg(node_load15{job="MONITOR-NodeExporter"})
                      /
                        count(count by (cpu) (node_cpu_seconds_total{job="MONITOR-NodeExporter"}))
                    )
                  *
                    10`
				},
				{
					title: 'RAM Used',
					key: '2-4',
					type: 'gauge',
					span: 6,
					height: 250,
					query: `avg(
                        (
                            (
                                    node_memory_MemTotal_bytes{job="MONITOR-NodeExporter"}
                                  -
                                    node_memory_MemFree_bytes{job="MONITOR-NodeExporter"}
                                -
                                  node_memory_Buffers_bytes{job="MONITOR-NodeExporter"}
                              -
                                node_memory_Cached_bytes{job="MONITOR-NodeExporter"}
                            )
                          /
                            node_memory_MemTotal_bytes{job="MONITOR-NodeExporter"}
                        )
                      *
                        100
                    )`
				}
			],
			key: '2',
			height: '250px'
		},
		{
			cols: [
				{
					title: 'CPU Basic',
					key: '3-1',
					type: 'line',
					span: 12,
					// y轴换算
					formatter: {
						formatterType: `*`,
						formatterCount: 100,
						unit: '%'
					},
					query: `label_replace(
                        avg(
                            sum by (instance) (irate(node_cpu_seconds_total{job="MONITOR-NodeExporter",mode="system"}[5m]))
                          / on (instance) group_left 
                            sum by (instance) (irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m]))
                        ),
                          "device",
                          "system",
                          "",
                          ""
                        )
                      or
                        label_replace(
                            avg(sum by(instance) (
                                irate(node_cpu_seconds_total{job="MONITOR-NodeExporter", mode="user"}[5m])
                              ) 
                              / 
                              on(instance) group_left 
                              sum by(instance) (
                                irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m])
                              )),
                          "device",
                          "user",
                          "",
                          ""
                        )
                        or
                        label_replace(
                            avg(
                                sum by(instance) (
                                  irate(node_cpu_seconds_total{job="MONITOR-NodeExporter", mode="iowait"}[5m])
                                ) 
                                / 
                                on(instance) group_left 
                                sum by(instance) (
                                  irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m])
                                )
                              ),
                            "device",
                            "iowait",
                            "",
                            ""
                        )
                        or
                        label_replace(
                            sum(
                                sum by(instance) (
                                  irate(node_cpu_seconds_total{job="MONITOR-NodeExporter", mode=~".*irq"}[5m])
                                ) 
                                / 
                                on(instance) group_left 
                                sum by(instance) (
                                  irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m])
                                )
                              ) 
                              / 
                              count(node_cpu_seconds_total{job="MONITOR-NodeExporter", mode=~".*irq"}),
                            "device",
                            "irq",
                            "",
                            ""
                        )
                        or 
                        label_replace(
                            sum(
                                sum by (instance) (
                                  irate(
                                    node_cpu_seconds_total{job="MONITOR-NodeExporter",mode!="idle",mode!="iowait",mode!="irq",mode!="softirq",mode!="system",mode!="user"}[5m]
                                  )
                                )
                              / on (instance) group_left 
                                sum by (instance) (irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m]))
                            )
                          /
                            count(
                              node_cpu_seconds_total{job="MONITOR-NodeExporter",mode!="idle",mode!="iowait",mode!="irq",mode!="softirq",mode!="system",mode!="user"}
                            ),
                            "device",
                            "other",
                            "",
                            ""
                        )
                        or
                        label_replace(
                            avg(
                                sum by (instance) (irate(node_cpu_seconds_total{job="MONITOR-NodeExporter",mode="idle"}[5m]))
                              / on (instance) group_left 
                                sum by (instance) (irate(node_cpu_seconds_total{job="MONITOR-NodeExporter"}[5m]))
                            ),
                            "device",
                            "idle",
                            "",
                            ""
                        )`,
					multiple: true
				},
				{
					title: 'Memory Basic',
					key: '3-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'GiB'
					},
					query: `label_replace(
                            sum(node_memory_MemTotal_bytes{job="MONITOR-NodeExporter"}) / (1024 * 1024 * 1024),
                            "device",
                            "total",
                            "",
                            ""
                          )
                        or
                          label_replace(
                            sum(
                                node_memory_MemTotal_bytes{job="MONITOR-NodeExporter"} 
                                - node_memory_MemFree_bytes{job="MONITOR-NodeExporter"} 
                                - (
                                    node_memory_Cached_bytes{job="MONITOR-NodeExporter"} 
                                    + node_memory_Buffers_bytes{job="MONITOR-NodeExporter"} 
                                    + node_memory_SReclaimable_bytes{job="MONITOR-NodeExporter"}
                                  )
                              ) /(1024 * 1024 * 1024),
                            "device",
                            "used",
                            "",
                            ""
                          )
                      or
                        label_replace(
                            sum(
                                node_memory_Cached_bytes{job="MONITOR-NodeExporter"} 
                                + node_memory_Buffers_bytes{job="MONITOR-NodeExporter"} 
                                + node_memory_SReclaimable_bytes{job="MONITOR-NodeExporter"}
                              ) /(1024 * 1024 * 1024),
                          "device",
                          "cache",
                          "",
                          ""
                        )
                     or
                        label_replace(
                            sum(node_memory_MemFree_bytes{job="MONITOR-NodeExporter"})/ (1024 * 1024 * 1024),
                            "device",
                            "free",
                            "",
                            ""
                        )
                    or
                        label_replace(
                            sum(
                                node_memory_SwapTotal_bytes{job="MONITOR-NodeExporter"} 
                                - node_memory_SwapFree_bytes{job="MONITOR-NodeExporter"}
                              ) /(1024 * 1024 * 1024),
                        "device",
                        "swap_used",
                        "",
                        ""
                        )`,
					multiple: true
				}
			],
			key: '3',
			height: '300px'
		},
		{
			cols: [
				{
					title: 'Network Traffic Basic',
					key: '4-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'kb/s'
					},
					query: `sum by (device) (
                        irate(node_network_receive_bytes_total{job="MONITOR-NodeExporter"}[5m]) * 8
                      ) / 1000 or sum by (device) (
                        irate(node_network_transmit_bytes_total{job="MONITOR-NodeExporter"}[5m]) * 8
                      ) / 1000 `,
					multiple: true // 是否是多条折线展示在一个坐标轴
				},
				{
					title: 'Disk Space Used Basic',
					key: '4-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `*`,
						formatterCount: 1,
						unit: '%'
					},
					query: `100 - avg by (mountpoint) (
                        node_filesystem_avail_bytes{job="MONITOR-NodeExporter", device!~"rootfs"} * 100
                        / node_filesystem_size_bytes{job="MONITOR-NodeExporter", device!~"rootfs"}
                      )`,
					multiple: true
				}
			],
			key: '4',
			height: '300px'
		}
	],
	DATALIGHT: [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: 'sum(process_uptime_seconds{job="{jobName}", instance=~"{instance}"})',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},

				{
					title: 'heap',
					key: '1-2',
					type: 'gauge',
					span: 9,
					query: `sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="heap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="heap"})`
				},
				{
					title: 'non-heap',
					key: '1-3',
					type: 'gauge',
					span: 9,
					query: `sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})`
				}
			],
			height: '350px',
			key: '1'
		},
		{
			cols: [
				{
					title: 'CPU Usage',
					key: '2-1',
					type: 'line',
					span: 12,
					query: `system_cpu_usage{job="{jobName}", instance=~"{instance}"}`
				},
				{
					title: 'Load Average',
					key: '2-2',
					type: 'line',
					span: 12,
					query: `system_load_average_1m{job="{jobName}", instance=~"{instance}"}`
				}
			],
			key: '2',
			height: '300px'
		}
	],
	'MONITOR-Prometheus': [
		{
			cols: [
				{
					// rows: [
					// {
					title: '持续时间[1H]',
					key: '1-1-1',
					type: 'text',
					query: 'avg(avg_over_time(up{instance=~"{instance}", job="{jobName}"}[1h]) * 100)',
					span: 6,
					unit: '%'
					// }
					// ]
				},
				{
					title: 'Total Series',
					key: '1-1-2',
					type: 'number',
					query: 'sum(prometheus_tsdb_head_series{job="{jobName}",instance="{instance}"})',
					span: 6
				},
				{
					title: 'Memory Chunks',
					key: '1-1-3',
					type: 'number',
					query: 'sum(prometheus_tsdb_head_chunks{job="{jobName}",instance="{instance}"})',
					span: 6
				},
				{
					title: 'Currently Down',
					key: '1-1-4',
					type: 'number',
					query: 'up{instance="{instance}", job="{jobName}"} < 1',
					span: 6
				}
			]
		},
		{
			cols: [
				{
					title: 'Failures and Errors',
					key: '1-2-1',
					type: 'line',
					query: 'sum(increase(net_conntrack_dialer_conn_failed_total{job="{jobName}", instance="{instance}"}[5m])) > 0',
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'Upness (stacked)',
					key: '1-3-1',
					type: 'line',
					query: 'up{job="{jobName}", instance="{instance}"}',
					span: 12
				},
				{
					title: 'Storage Memory Chunks',
					key: '1-3-2',
					type: 'line',
					query: 'prometheus_tsdb_head_chunks{job="{jobName}", instance="{instance}"}',
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'Series Count',
					key: '1-4-1',
					type: 'line',
					query: 'prometheus_tsdb_head_series{job="{jobName}", instance="{instance}"}',
					span: 12
				},
				{
					title: 'Series Created / Removed',
					key: '1-4-2',
					type: 'line',
					query: 'sum( increase(prometheus_tsdb_head_series_created_total{job="{jobName}", instance="{instance}"}[5m]) )',
					span: 12
				}
			]
		}
	],
	'MONITOR-AlertManager': [
		{
			cols: [
				{
					title: 'Instances',
					key: '1-1-1',
					type: 'number',
					query: 'count(alertmanager_build_info{instance=~"{instance}"})',
					span: 6
				},
				{
					title: '持续时间',
					key: '1-1-2',
					type: 'text',
					query: '(time() - alertmanager_config_last_reload_success_timestamp_seconds{instance=~"{instance}"})',
					unit: 'formatTime',
					span: 6
				},
				{
					title: 'Last reload sucessfull',
					key: '1-1-3',
					type: 'number',
					query: 'alertmanager_config_last_reload_successful{instance=~"{instance}"}',
					span: 6
				},
				{
					title: 'Cluster size',
					key: '1-1-4',
					type: 'number',
					query: 'max(alertmanager_cluster_members{instance=~"{instance}"})',
					span: 6
				}
			]
		},
		{
			cols: [
				{
					title: 'Active alerts',
					key: '1-2-1',
					type: 'number',
					query: 'max(alertmanager_alerts{state="active", instance=~"{instance}"})',
					span: 8
				},
				{
					title: 'Number of suppressed alerts',
					key: '1-2-2',
					type: 'number',
					query: 'max(alertmanager_alerts{state="suppressed", instance=~"{instance}"})',
					span: 8
				},
				{
					title: 'Number of active silences',
					key: '1-2-3',
					type: 'number',
					query: 'max(alertmanager_alerts{state="suppressed", instance=~"{instance}"})',
					span: 8
				}
			]
		},
		{
			cols: [
				{
					title: 'Clusterhealth score',
					key: '1-3-1',
					type: 'line',
					query: 'alertmanager_cluster_health_score{instance=~"{instance}"}',
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'Cluster members count',
					key: '1-3-2',
					type: 'line',
					query: 'alertmanager_cluster_members{instance=~"{instance}"}',
					span: 24
				}
			]
		}
	],
	'MONITOR-MySQLExporter': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					query: 'mysql_global_status_uptime{job=~"{jobName}", instance=~"{instance}"}',
					unit: 'formatTime',
					span: 8
				},
				{
					title: 'Current QPS',
					key: '1-1-2',
					type: 'text',
					query: 'rate(mysql_global_status_queries{job=~"{jobName}", instance=~"{instance}"}[600s])',
					span: 8
				},
				{
					title: 'InnoDB Buffer Pool',
					key: '1-1-3',
					type: 'byte',
					query: 'mysql_global_variables_innodb_buffer_pool_size{job=~"{jobName}", instance=~"{instance}"}',
					span: 8
				}
			]
		},
		{
			cols: [
				{
					title: 'MySQL Connections',
					key: '1-2-1',
					type: 'line',
					query: `label_replace(sum(max_over_time(mysql_global_status_threads_connected{job=~"MONITOR-MySQLExporter", instance=~"{instance}"}[600s])), "device", "Connections", "", "") 
					or 
					label_replace(sum(mysql_global_status_max_used_connections{job=~"MONITOR-MySQLExporter", instance=~"{instance}"}), "device", "Max Used Connections", "", "")
					or
					label_replace(sum(mysql_global_variables_max_connections{job=~"MONITOR-MySQLExporter", instance=~"{instance}"}), "device", "Max Connections", "", "")
					`,
					span: 12,
					multiple: true
				},
				{
					title: 'MySQL Client Thread Activity',
					key: '1-2-2',
					type: 'line',
					query: `label_replace(sum(max_over_time(mysql_global_status_threads_connected{job=~"{jobName}", instance=~"{instance}"}[600s])), "device", "Peak Threads Connected", "", "") 
					or 
					label_replace(sum(max_over_time(mysql_global_status_threads_running{job=~"{jobName}", instance=~"{instance}"}[600s])), "device", "Peak Threads Running", "", "")
					or
					label_replace(sum(avg_over_time(mysql_global_status_threads_running{job=~"{jobName}", instance=~"{instance}"}[600s])), "device", "Avg Threads Running", "", "")
					`,
					span: 12,
					multiple: true
				}
			]
		},
		{
			cols: [
				{
					title: 'MySQL Questions',
					key: '1-3-1',
					type: 'line',
					query: 'rate(mysql_global_status_questions{job=~"{jobName}", instance=~"{instance}"}[600s])',
					span: 12
				},
				{
					title: 'MySQL Thread Cache',
					key: '1-3-1',
					type: 'line',
					query: `label_replace(sum(mysql_global_variables_thread_cache_size{job=~"{jobName}", instance=~"{instance}"}), "device", "Thread Cache Size", "", "")
					or
					label_replace(sum(mysql_global_status_threads_cached{job=~"{jobName}", instance=~"{instance}"}), "device", "Thread Cache", "", "")
					or
					label_replace(sum(rate(mysql_global_status_threads_created{job=~"{jobName}", instance=~"{instance}"}[600s])), "device", "Thread Created", "", "")
					`,
					span: 12,
					multiple: true
				}
			]
		}
	],
	'MONITOR-NodeExporter': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					unit: 'formatTime',
					query:
						'node_time_seconds{instance="{instance}",job="{jobName}"} - node_boot_time_seconds{instance="{instance}",job="{jobName}"}',
					span: 8
				},

				{
					title: 'CPU Cores',
					key: '1-1-2',
					type: 'number',
					query: 'count(count(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}) by (cpu))',
					span: 4
				},
				{
					title: 'RootFS Total',
					key: '1-1-3',
					type: 'byte',
					query: 'node_filesystem_size_bytes{instance="{instance}",job="{jobName}",mountpoint="/",fstype!="rootfs"}',
					span: 4
				},

				{
					title: 'RAM Total',
					key: '1-1-4',
					type: 'byte',
					query: 'node_memory_MemTotal_bytes{instance="{instance}",job="{jobName}"}',
					span: 4
				},
				{
					title: 'SWAP Total',
					key: '1-1-5',
					type: 'byte',
					query: 'node_memory_SwapTotal_bytes{instance="{instance}",job="{jobName}"}',
					span: 4
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Busy',
					key: '1-2-1',
					type: 'gauge',
					query:
						'(sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode!="idle"}[1m])) / on(instance) group_left sum by (instance)((irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])))) * 100',
					span: 6
				},
				{
					title: 'Sys Load (5m avg)',
					key: '1-2-2',
					type: 'gauge',
					query:
						'avg(node_load5{instance="{instance}",job="{jobName}"}) /  count(count(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}) by (cpu)) * 100',
					span: 6
				},
				{
					title: 'Sys Load (15m avg)',
					key: '1-2-3',
					type: 'gauge',
					query:
						'avg(node_load15{instance="{instance}",job="{jobName}"}) /  count(count(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}) by (cpu)) * 100',
					span: 6
				},
				{
					title: 'RAM Used',
					key: '1-2-4',
					type: 'gauge',
					query:
						'100 - ((node_memory_MemAvailable_bytes{instance="{instance}",job="{jobName}"} * 100) / node_memory_MemTotal_bytes{instance="{instance}",job="{jobName}"})',
					span: 6
				}
			]
		},
		{
			cols: [
				{
					title: 'SWAP Used',
					key: '1-3-1',
					type: 'gauge',
					query:
						'((node_memory_SwapTotal_bytes{instance="{instance}",job="{jobName}"} - node_memory_SwapFree_bytes{instance="{instance}",job="{jobName}"}) / (node_memory_SwapTotal_bytes{instance="{instance}",job="{jobName}"} )) * 100',
					span: 12
				},
				{
					title: 'Root FS Used',
					key: '1-3-2',
					type: 'gauge',
					query:
						'100 - ((node_filesystem_avail_bytes{instance="{instance}",job="{jobName}",mountpoint="/",fstype!="rootfs"} * 100) / node_filesystem_size_bytes{instance="{instance}",job="{jobName}",mountpoint="/",fstype!="rootfs"})',
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Basic',
					key: '1-4-1',
					type: 'line',
					// y轴换算
					formatter: {
						formatterType: `*`,
						formatterCount: 100,
						unit: '%'
					},
					query: `label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode="system"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Busy System", "", ""
					) or label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode="user"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Busy User", "", ""
					) or label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode="iowait"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Busy Iowait", "", ""
					) or label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode=~".*irq"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Busy IRQs", "", ""
					) or label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode!="idle", mode!="user", mode!="system", mode!="iowait", mode!="irq", mode!="softirq"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Busy Other", "", ""
					) or label_replace(
						sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}", mode="idle"}[1m])) 
						/ on(instance) group_left sum by(instance) (irate(node_cpu_seconds_total{instance="{instance}",job="{jobName}"}[1m])),
						"device", "Idle", "", ""
					)
					`,
					span: 12,
					multiple: true
				},
				{
					title: 'Memory Basic',
					key: '1-4-2',
					type: 'line',
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'GB'
					},
					query: `label_replace(
						node_memory_MemTotal_bytes{instance="{instance}",job="{jobName}"}/(1024 * 1024 * 1024),
						"device", "RAM Total", "", ""
					) or label_replace(
						(node_memory_MemTotal_bytes{instance="{instance}",job="{jobName}"} - node_memory_MemFree_bytes{instance="{instance}",job="{jobName}"} - (node_memory_Cached_bytes{instance="{instance}",job="{jobName}"} + node_memory_Buffers_bytes{instance="{instance}",job="{jobName}"} + node_memory_SReclaimable_bytes{instance="{instance}",job="{jobName}"}))/(1024 * 1024 * 1024),
						"device", "RAM Used", "", ""
					) or label_replace(
						(node_memory_Cached_bytes{instance="{instance}",job="{jobName}"} + node_memory_Buffers_bytes{instance="{instance}",job="{jobName}"} + node_memory_SReclaimable_bytes{instance="{instance}",job="{jobName}"})/(1024 * 1024 * 1024),
						"device", "RAM Cache + Buffer", "", ""
					) or label_replace(
						node_memory_MemFree_bytes{instance="{instance}",job="{jobName}"} / (1024 * 1024 * 1024),
						"device", "RAM Free", "", ""
					) or label_replace(
						(node_memory_SwapTotal_bytes{instance="{instance}",job="{jobName}"} - node_memory_SwapFree_bytes{instance="{instance}",job="{jobName}"})/(1024 * 1024 * 1024),
						"device", "SWAP Used", "", ""
					)
					`,
					span: 12,
					multiple: true
				}
			]
		},
		{
			cols: [
				{
					title: 'Network Traffic Basic',
					key: '1-5-1',
					type: 'line',
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'kb/s'
					},
					query: `label_replace(
						irate(node_network_receive_bytes_total{instance="{instance}", job="{jobName}"}[5m]) * 8 /1000,
						"direction", "receive", "", ""
					  )
					  or
					  label_replace(
						irate(node_network_transmit_bytes_total{instance="{instance}", job="{jobName}"}[5m]) * 8 /1000,
						"direction", "transmit", "", ""
					  )
					  `,
					span: 12,
					multiple: true
				},
				{
					title: 'Disk Space Used Basic',
					key: '1-5-2',
					type: 'line',
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: '%'
					},
					query: `100 - ((node_filesystem_avail_bytes{instance="{instance}",job="{jobName}",device!~'rootfs'} * 100) / node_filesystem_size_bytes{instance="{instance}",job="{jobName}",device!~'rootfs'})
					  `,
					span: 12,
					multiple: true
				}
			]
		}
	],
	'MONITOR-Grafana': [
		{
			cols: [
				{
					title: 'Active instances',
					key: '1-1-1',
					type: 'number',
					query: `up{job="{jobName}"}`,
					span: 6
				},
				{
					title: 'Dashboard count',
					key: '1-1-2',
					type: 'number',
					query: `grafana_stat_totals_dashboard`,
					span: 6
				},
				{
					title: 'User count',
					key: '1-1-3',
					type: 'number',
					query: `grafana_stat_total_users`,
					span: 6
				},
				{
					title: 'Playlist count',
					key: '1-1-4',
					type: 'number',
					query: `grafana_stat_total_playlists`,
					span: 6
				}
			]
		},
		{
			cols: [
				{
					title: 'http status codes',
					key: '1-2-1',
					type: 'line',
					query: `sum by (statuscode) (irate(http_request_total{job='{jobName}'}[5m]))`,
					span: 12
				},
				{
					title: 'Requests by routing group',
					key: '1-2-2',
					type: 'line',
					query: `label_replace(
						sum(irate(grafana_api_response_status_total[5m])),
						"device", "api", "", ""
					  )
					  or
					  label_replace(
						sum(irate(grafana_proxy_response_status_total[5m])),
						"device", "proxy", "", ""
					  )
					  or
					  label_replace(
						sum(irate(grafana_page_response_status_total[5m])),
						"device", "web", "", ""
					  )
					  `,
					span: 12,
					multiple: true
				}
			]
		},
		{
			cols: [
				{
					title: 'Grafana active alerts',
					key: '1-3-1',
					type: 'line',
					query: `increase(grafana_alerting_active_alerts[1m])`,
					span: 12
				},
				{
					title: 'Prometheus alerts',
					key: '1-3-2',
					type: 'line',
					query: `sum (ALERTS)`,
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'Grafana performance',
					key: '1-4-11',
					type: 'line',
					query: `label_replace(
						sum(go_goroutines{job="{jobName}"}),
						"device", "go routines", "", ""
					  )
					  or
					  label_replace(
						sum(process_resident_memory_bytes{job="grafana"}),
						"device", "memory usage", "", ""
					  )`,
					span: 24,
					multiple: true
				}
			]
		}
	],
	'DOLPHINSCHEDULER-DSAlertServer': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: 'sum(process_uptime_seconds{job="{jobName}", instance=~"{instance}"})',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},
				{
					title: 'Heap Used',
					key: '1-2-1',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="heap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="heap"})',
					span: 9
				},
				{
					title: 'Non-Heap Used',
					key: '1-2-2',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})',
					span: 9
				}
			]
		},
		{
			cols: [
				{
					title: 'Process Open Files',
					key: '1-3-1',
					type: 'line',
					query: `
						process_files_open_files{job="{jobName}", instance=~"{instance}"}
					 `,
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Usage',
					key: '1-4-1',
					type: 'line',
					query: `system_cpu_usage{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				},
				{
					title: 'Load Average',
					key: '1-4-2',
					type: 'line',
					query: `system_load_average_1m{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				}
			]
		}
	],
	'DOLPHINSCHEDULER-DSMasterServer': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: 'sum(process_uptime_seconds{job="{jobName}", instance=~"{instance}"})',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},
				{
					title: 'Heap Used',
					key: '1-2-1',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="heap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="heap"})',
					span: 9
				},
				{
					title: 'Non-Heap Used',
					key: '1-2-2',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})',
					span: 9
				}
			]
		},
		{
			cols: [
				{
					title: 'Process Open Files',
					key: '1-3-1',
					type: 'line',
					query: `
						process_files_open_files{job="{jobName}", instance=~"{instance}"}
					 `,
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Usage',
					key: '1-4-1',
					type: 'line',
					query: `system_cpu_usage{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				},
				{
					title: 'Load Average',
					key: '1-4-2',
					type: 'line',
					query: `system_load_average_1m{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				}
			]
		}
	],
	'DOLPHINSCHEDULER-DSApiServer': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: 'sum(process_uptime_seconds{job="{jobName}", instance=~"{instance}"})',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},
				{
					title: 'Heap Used',
					key: '1-2-1',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="heap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="heap"})',
					span: 9
				},
				{
					title: 'Non-Heap Used',
					key: '1-2-2',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})',
					span: 9
				}
			]
		},
		{
			cols: [
				{
					title: 'Process Open Files',
					key: '1-3-1',
					type: 'line',
					query: `
						process_files_open_files{job="{jobName}", instance=~"{instance}"}
					 `,
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Usage',
					key: '1-4-1',
					type: 'line',
					query: `system_cpu_usage{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				},
				{
					title: 'Load Average',
					key: '1-4-2',
					type: 'line',
					query: `system_load_average_1m{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				}
			]
		}
	],
	'DOLPHINSCHEDULER-DSWorkerServer': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: 'sum(process_uptime_seconds{job="{jobName}", instance=~"{instance}"})',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},
				{
					title: 'Heap Used',
					key: '1-2-1',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="heap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="heap"})',
					span: 9
				},
				{
					title: 'Non-Heap Used',
					key: '1-2-2',
					type: 'gauge',
					query:
						'sum(jvm_memory_used_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})*100/sum(jvm_memory_max_bytes{job="{jobName}", instance=~"{instance}", area="nonheap"})',
					span: 9
				}
			]
		},
		{
			cols: [
				{
					title: 'Process Open Files',
					key: '1-3-1',
					type: 'line',
					query: `
						process_files_open_files{job="{jobName}", instance=~"{instance}"}
					 `,
					span: 24
				}
			]
		},
		{
			cols: [
				{
					title: 'CPU Usage',
					key: '1-4-1',
					type: 'line',
					query: `system_cpu_usage{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				},
				{
					title: 'Load Average',
					key: '1-4-2',
					type: 'line',
					query: `system_load_average_1m{job="{jobName}", instance=~"{instance}"}`,
					span: 12
				}
			]
		}
	],
	'ZOOKEEPER-QuarumPeermain': [
		{
			cols: [
				{
					title: 'global_sessions',
					key: '1-1-1',
					type: 'number',
					query: 'global_sessions{instance=~"{instance}",job=~"{jobName}"}',
					span: 12
				},
				{
					title: 'local_sessions',
					key: '1-1-2',
					type: 'number',
					query: 'local_sessions{instance=~"{instance}",job=~"{jobName}"}',
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'znode_count',
					key: '1-2-1',
					type: 'line',
					query: `label_replace(
						znode_count{instance=~"{instance}",job=~"{jobName}"},
						"device", "znode_count", "", ""
					  )
					  or
					  label_replace(
						ephemerals_count{instance=~"{instance}",job=~"{jobName}"},
						"device", "ephemerals", "", ""
					  )`,
					span: 12,
					multiple: true
				},
				{
					title: 'znode_count_rate',
					key: '1-2-2',
					type: 'line',
					query: `label_replace(
						rate(znode_count{instance=~"{instance}",job=~"{jobName}"}[5m]),
						"device", "znode_count_rate", "", ""
					  )
					  or
					  label_replace(
						rate(ephemerals_count{instance=~"{instance}",job=~"{jobName}"}[5m]),
						"device", "ephemerals_rate", "", ""
					  )`,
					span: 12,
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'ops/s'
					},
					multiple: true
				}
			]
		},
		{
			cols: [
				{
					title: 'write_per_namespace',
					key: '1-3-1',
					type: 'line',
					query: `
						write_per_namespace_sum{instance=~"{instance}",job=~"{jobName}"} / 1024`,
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'kB'
					},
					multiple: true
				},
				{
					title: 'read_per_namespace',
					key: '1-3-2',
					type: 'line',
					query: `read_per_namespace_sum{instance=~"{instance}",job=~"{jobName}"} / 1024`,
					span: 12,
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'kB'
					},
					multiple: true
				}
			]
		}
	],
	'HDFS-DataNode': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"}/1000)',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `avg(process_start_time_seconds{job="{jobName}", instance=~"{instance}"})*1000`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},

				{
					title: 'dn_capacity',
					key: '1-2',
					type: 'line',
					span: 9,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'GB'
					},
					query: `Hadoop_DataNode_Capacity{name="FSDatasetState", instance="{instance}"} / (1024 * 1024 * 1024)`
				},
				{
					title: 'dn_dfs_used',
					key: '1-3',
					type: 'line',
					span: 9,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'kB'
					},
					query: `Hadoop_DataNode_DfsUsed{name="FSDatasetState", instance="{instance}"} / 1024`
				}
			],
			height: '350px',
			key: '1'
		},
		{
			cols: [
				{
					title: 'dn_remaining',
					key: '2-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'GB'
					},
					query: `Hadoop_DataNode_Remaining{name="FSDatasetState", instance="{instance}"} / (1024 * 1024 * 1024)`
				},
				{
					title: 'dn_last_volume_failures',
					key: '2-2',
					type: 'line',
					span: 12,
					query: `Hadoop_DataNode_VolumeFailures{instance="{instance}"}`
				}
			],
			key: '2'
		}
	],
	'HDFS-HttpFS': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				},
				{
					title: '开始时间',
					key: '1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				}
			]
		}
	],
	'HDFS-ZKFailoverController': [
		{
			cols: [
				{
					title: '开始时间',
					key: '1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				},
				{
					title: '持续时间',
					key: '1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				}
			]
		}
	],
	'HIVE-MetaStore': [
		{
			cols: [
				{
					title: '开始时间',
					key: '1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				},
				{
					title: '持续时间',
					key: '1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				}
			]
		}
	],
	'HDFS-JournalNode': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},

				{
					title: 'jn_syncs_60s_95th_percentile_latency_micros',
					key: '1-2',
					type: 'line',
					span: 9,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'μs'
					},
					query: `Hadoop_JournalNode_Syncs60s95thPercentileLatencyMicros`
				},
				{
					title: 'jn_syncs_60s_99th_percentile_latency_micros',
					key: '1-3',
					type: 'line',
					span: 9,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'μs'
					},
					query: `Hadoop_JournalNode_Syncs60s99thPercentileLatencyMicros`
				}
			],
			height: '350px',
			key: '1'
		},
		{
			cols: [
				{
					title: 'jn_syncs_300s_95th_percentile_latency_micros',
					key: '2-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'μs'
					},
					query: 'Hadoop_JournalNode_Syncs300s95thPercentileLatencyMicros'
				},
				{
					title: 'jn_syncs_300s_99th_percentile_latency_micros',
					key: '2-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'μs'
					},
					query: `Hadoop_JournalNode_Syncs300s99thPercentileLatencyMicros`
				}
			],
			key: '2'
		},
		{
			cols: [
				{
					title: 'jn_batches_written_rate',
					key: '3-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'c/s'
					},
					query: 'rate(Hadoop_JournalNode_BatchesWritten{instance="{instance}"}[1m])'
				},
				{
					title: 'nv_bytes_written_rate',
					key: '3-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'B/s'
					},
					query: `rate(Hadoop_JournalNode_BytesWritten{instance="{instance}"}[1m])`
				}
			],
			key: '3'
		},
		{
			cols: [
				{
					title: 'jjn_jvm_gc_count_rate',
					key: '4-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'c/s'
					},
					query: 'rate(Hadoop_JournalNode_GcCount{instance="{instance}"}[1m])'
				},
				{
					title: 'jn_jvm_gc_time_millis_rate',
					key: '4-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'ms'
					},
					query: `rate(Hadoop_JournalNode_GcTimeMillis{instance="{instance}"}[1m])`
				}
			],
			key: '4'
		},
		{
			cols: [
				{
					title: 'jn_jvm_mem_nonheap_usedM',
					key: '5-1',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'MB'
					},
					query: 'Hadoop_JournalNode_MemNonHeapUsedM{instance="{instance}"}'
				},
				{
					title: 'jn_mem_heap_usedM',
					key: '5-2',
					type: 'line',
					span: 12,
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'MB'
					},
					query: `Hadoop_JournalNode_MemHeapUsedM{instance="{instance}"}`
				}
			],
			key: '5'
		}
	],
	'HDFS-NameNode': [
		{
			cols: [
				{
					rows: [
						{
							title: '持续时间',
							key: '1-1-1',
							type: 'text',
							query: '(time() - Hadoop_NameNode_NNStartedTimeInMillis{instance="{instance}"} / 1000)',
							span: 4,
							unit: 'formatTime'
						},
						{
							title: '开始时间',
							key: '1-1-2',
							type: 'time',
							query: `Hadoop_NameNode_NNStartedTimeInMillis{instance="{instance}"}`,
							span: 4
						}
					],
					span: 6,
					key: '1-1'
				},
				{
					title: 'nn_dn_total_capacity_remaining',
					key: '1-2',
					type: 'byte',
					span: 9,
					query: `Hadoop_NameNode_CapacityRemaining{ name="FSNamesystem",instance="{instance}"}`
				},
				{
					title: 'nn_dn_capacity_used',
					key: '1-3',
					type: 'byte',
					span: 9,
					query: `Hadoop_NameNode_CapacityUsed{name='FSNamesystem',instance="{instance}"}`
				}
			],
			height: '350px',
			key: '1'
		},
		{
			cols: [
				{
					title: 'nn_total_sync_count',
					key: '2-1',
					type: 'line',
					span: 12,
					query: `Hadoop_NameNode_TotalSyncCount{name='FSNamesystem'}`
				},
				{
					title: 'nn_file_created_ops',
					key: '2-2',
					type: 'line',
					span: 12,
					query: `avg(Hadoop_NameNode_CreateFileOps) by (instance)`
				}
			],
			key: '2'
		},
		{
			cols: [
				{
					title: 'nn_files_created',
					key: '3-1',
					type: 'line',
					span: 12,
					query: 'avg(Hadoop_NameNode_FilesCreated) by (instance)'
				},
				{
					title: 'nn_files_appended',
					key: '3-2',
					type: 'line',
					span: 12,
					query: `avg(Hadoop_NameNode_FilesAppended) by (instance)`
				}
			],
			key: '3'
		}
	],
	'DORIS-BEServer': [
		{
			cols: [
				{
					title: 'Cluster Number',
					key: '1-1',
					type: 'number',
					span: 4,
					query: `count(node_info{type="is_master"})`
				},
				{
					title: 'Cluster FE JVM Heap Stat',
					key: '1-2',
					type: 'line',
					span: 10,
					query: `sum(jvm_heap_size_bytes{group="fe", type="used"} * 100) by (instance, job) / sum(jvm_heap_size_bytes{group="fe", type="max"}) by (instance, job)`
				},
				{
					title: 'Cluster BE CPU Idle',
					key: '1-3',
					type: 'line',
					span: 10,
					// y轴换算
					formatter: {
						formatterType: `*`,
						formatterCount: 100,
						unit: '%'
					},
					query: `(sum(rate(doris_be_cpu{mode="idle"}[5m])) by (job)) / (sum(rate(doris_be_cpu[5m])) by (job))`
				}
			]
		},
		{
			cols: [
				{
					title: 'Cluster BE Mem Stat',
					key: '1-1',
					type: 'line',
					span: 12,
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'MB'
					},
					query: `avg(doris_be_memory_allocated_bytes) by (job) / 1024 / 1024`
				},
				{
					title: 'Cluster QPS Stat',
					key: '1-2',
					type: 'line',
					span: 12,
					query: `sum by (job)(rate(doris_fe_query_total{group="fe"}[5m]))`
				}
			]
		}
	],
	'DORIS-FEServer': [
		{
			cols: [
				{
					title: 'Cluster Number',
					key: '1-1',
					type: 'number',
					span: 4,
					query: `count(node_info{type="is_master"})`
				},
				{
					title: 'Cluster FE JVM Heap Stat',
					key: '1-2',
					type: 'line',
					span: 10,
					query: `sum(jvm_heap_size_bytes{group="fe", type="used"} * 100) by (instance, job) / sum(jvm_heap_size_bytes{group="fe", type="max"}) by (instance, job)`
				},
				{
					title: 'Cluster BE CPU Idle',
					key: '1-3',
					type: 'line',
					span: 10,
					// y轴换算
					formatter: {
						formatterType: `*`,
						formatterCount: 100,
						unit: '%'
					},
					query: `(sum(rate(doris_be_cpu{mode="idle"}[5m])) by (job)) / (sum(rate(doris_be_cpu[5m])) by (job))`
				}
			]
		},
		{
			cols: [
				{
					title: 'Cluster BE Mem Stat',
					key: '1-1',
					type: 'line',
					span: 12,
					// y轴换算
					formatter: {
						formatterType: `/`,
						formatterCount: 1,
						unit: 'MB'
					},
					query: `avg(doris_be_memory_allocated_bytes) by (job) / 1024 / 1024`
				},
				{
					title: 'Cluster QPS Stat',
					key: '1-2',
					type: 'line',
					span: 12,
					query: `sum by (job)(rate(doris_fe_query_total{group="fe"}[5m]))`
				}
			]
		}
	],
	'YARN-ResourceManager': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 6,
					unit: 'formatTime'
				},
				{
					title: '开始时间',
					key: '1-1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 6
				},
				{
					title: 'am_total_launched',
					key: '1-2',
					type: 'number',
					span: 6,
					query: `sum(Hadoop_ResourceManager_AMLaunchDelayNumOps)`
				},
				{
					title: 'am_total_registered',
					key: '1-3',
					type: 'number',
					span: 6,
					query: `sum(Hadoop_ResourceManager_AMRegisterDelayNumOps)`
				}
			],
			height: '150px',
			key: '1'
		}
	],
	'YARN-HistoryServer': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				},
				{
					title: '开始时间',
					key: '1-1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'rm_gc_count_rate',
					key: '1-2-1',
					type: 'line',
					query: 'rate(Hadoop_JobHistoryServer_GcCount[1m])',
					span: 12
				},
				{
					title: 'rm_gc_time_rate',
					key: '1-2-2',
					type: 'line',
					query: `rate(Hadoop_JobHistoryServer_GcTimeMillis[1m])`,
					span: 12
				}
			]
		}
	],
	'YARN-NodeManager': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				},
				{
					title: '开始时间',
					key: '1-1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				}
			]
		}
	],
	'YARN-TimelineServer': [
		{
			cols: [
				{
					title: '持续时间',
					key: '1-1-1',
					type: 'text',
					query: '(time() - java_lang_Runtime_StartTime{instance="{instance}"} / 1000)',
					span: 12,
					unit: 'formatTime'
				},
				{
					title: '开始时间',
					key: '1-1-2',
					type: 'time',
					query: `java_lang_Runtime_StartTime{instance="{instance}"}`,
					span: 12
				}
			]
		},
		{
			cols: [
				{
					title: 'rm_gc_count_rate',
					key: '1-2-1',
					type: 'line',
					query: 'rate(Hadoop_JobHistoryServer_GcCount[1m])',
					span: 12
				},
				{
					title: 'rm_gc_time_rate',
					key: '1-2-2',
					type: 'line',
					query: `rate(Hadoop_JobHistoryServer_GcTimeMillis[1m])`,
					span: 12
				}
			]
		}
	]
};
